Xbasic

JSON Functions

Description

Alpha Anywhere provides the following functions for working with JSON data.

Name
Description
a5_compact_json Function

Generates a compacted JSON string as a pointer variable.

a5_expand_json Function

Combines field mappings and JSON data into a single JSON string.

a5_getCalendarEventDataJSON Function

Used in the UX Component for the Calendar Control to get events for a date range in the required JSON format.

a5_json_extractValues Function

Extracts name/value pairs from a JSON string.

a5_json_populateArray Function

Takes an array of JSON objects and populates an Xbasic property array.

a5_json_prep Function

Removes null values from a property object.

a5_json_to_excel Function

Exports data in a JSON document to an Excel file.

a5_json_viewer Function

The a5_json_viewer function can be used to open a viewer for JSON data.

a5_MakeJSONIndexFile Function

Takes an input JSON file (an array of objects) and creates two files. An index file with just the key fields and offset and length, and a raw file with the original data

a5_makeJsonTree Function

Takes an array and makes a JSON tree. Array has these properties at a minimum: .label, .level.

a5_merge_json_into_template Function

The a5_merge_JSON_into_template function merges JSON data into a client-side template.

a5_sql_nested_query_to_json_document Function

Execute queries against one or more SQL databases, returning the result as a JSON document.

a5_sql_schema_to_json Function

Generates a JSON object describing a schema for a SQL database.

a5_url_from_storageJSONFormat Function

Generates a signed URL to download a file from Amazon S3 storage.

a5_XbasicTreeToJsonTree Function

Converts a CRLF delimited string that Xdialog uses for Tree Control data to a JSON string.

a5w_ajaxToJSON Function

Dumps out JSON from a data source.

a5wcb_convertFriendlyMenuToExpandingMenuJSONData Function

Generates the JSON to populate an Expanding Menu control from a 'friendly' menu definition.

argumentsFromJSON Function

Appends arguments to an argument object from a JSON argument definition

argumentsToJSON Function

Serializes arguments to a JSON string.

crlf_to_json Function

Convert a CR-LF delimited list of records into a JSON object.

csv_to_json Function

Convert a comma-delimited CSV string to JSON.

handlebars_template_merge Function

Merges JSON data into a template using Handlebars syntax.

json_combineProperties Function

Combines the properties in two JSON strings into a single JSON string.

json_composite Function

Turns flat lists into a tree structure.

json_delete Function

Remove any nested array member that matches pattern.

json_enumerate Function

Lists all of the top level property names.

json_extract Function

Extracts a property from a JSON object.

json_filter Function

The json_filter() Function - Extracts or omits certain properties from a JSON string. NOTE: Conceptually, this function is similar to the filter_string() function, except that it operates on JSON strings.

json_flatten Function

The json_flatten function takes a JSON string that defines an array of hierarchical objects and 'flattens' the array.

json_flatten_default Function

Takes JSON with nested arrays and "flattens" the JSON so that there are no nested arrays.

json_flatten_singlerow Function

Takes a JSON string with nested arrays and flattens the JSON so that there are no nested arrays. Data from the nested arrays are represented represented in the parent data as a set of repeating fields.

json_from_bson Function

BSON was created by the developers of Mongo DB. BSON is JSON data that is converted to binary. The json_from_bson() function converts BSON data back into JSON.

json_from_xml Function

Produces JSON from xml. The subformat of XML is the Atom format.

json_from_xml_OData Function

Takes OData format xml, which is basically feed xml. Feeds are a number of items. Allows you to convert xml that has been retrieved from a service that has Atom xml output of OData 2.0 or earlier.

json_from_yaml Function

Converts a string containing YAML to JSON.

json_generate Function

Generate takes a variable, an Xbasic dot variable, and returns a string containing a JavaScript object literal.

json_get_array_length Function

Returns the length of a JSON array.

json_normalize Function

Generates a grouped JSON content from a flat JSON object list, and supplied columns to group on.

json_parse Function

The json_parse function parses a string in JSON format and returns an Xbasic dot variable.

json_path Function

Extracts a portion of a JSON string.

json_reformat Function

Takes json and reformats it so that it is presented on one line or extended to include multiple lines.

json_reformat_safe Function

The json_reformat_safe() function reformats a string of JSON data with line-breaks and optional indentation.

json_sample_array Function

Enumerate top level properties in array entries and return name + count.

json_sanitize Function

Convert javascript object data to strict JSON, useful when copying snippets from javascript.

json_select Function

Generates a string containing a Javascript array with data from the specified columns of a JSON object.

json_shred Function

Converts a complex JSON string representing an array of objects with nested arrays into individual arrays that do not have any nested arrays.

json_sqlQuery Function

json_sqlQuery Function allows you to filter a JSON array using a simple SQL query syntax.

json_standardize Function

JSON_standardize function takes a non-standard JSON string and standardizes it. It also corrects for trailing commas in the JSON (which are illegal). Returns the standardized JSON.

json_to_bson Function

BSON was created by the developers of Mongo DB. BSON is JSON data that is converted to binary.

json_to_crlf Function

Convert json to crlf data.

json_to_xml Function

json_to_xml Function - Convert JSON to XML - Takes a string of JSON data and converts it to XML. json_to_xml Function - ATOM Format - The json_to_xml function can now generate XML using the "atom" format:

json_to_yaml Function

Converts a JSON string to YAML.

json_validate Function

Returns an empty string if the JSON is valid. Otherwise it returns an error message to tell you what is wrong with the JSON.

property_from_json Function

The property_from_json() requires proper JSON, but is 2 to 5 times faster than json_parse()

property_to_json Function

Takes a property, like a dot variable, and converts it to a JSON object.

rsToJSON Function

Takes an AlphaDAO resultset and converts the data to a JSON object.

varToJSON Function

Converts an Xbasic variable to a JSON representation.

varToJSONHash Function

The varToJSONHash() Function converts an Xbasic property array to a JSON hash.

varToJSONStandard Function

Converts an Xbasic variable to a JSON representation. If flagSpecialTags is .t. then you can use {function} and optional {functionArguments:var1,var2} in a property value to encode as a function. You can also use {Javascript} for arbitrary Javascript.

Other JSON Functions

excel_to_json()

Takes an Excel file and returns a string of JSON data.